package com.abase.site.client.events;

import com.google.gwt.event.shared.GwtEvent;

public class LoginResponseEvent extends GwtEvent<LoginResponseHandler> {

  /**
   * Specific context for this event.
   */
  public static class LoginResponseContext {

    /**
     * Opaque Object to hold the profile
     */
    private Object profile = null;

    /**
     * Email address of the logged in user
     */
    private String email = null;
    public String getEmail() { return this.email; }

    public Object getProfile() { return this.profile; }

    public void setEmail(final String email) { this.email = email; }
    public void setProfile(final Object profile) { this.profile = profile; }
  }

  public static final GwtEvent.Type<LoginResponseHandler> TYPE = new GwtEvent.Type<LoginResponseHandler>();

  private LoginResponseContext context = null;
  
  public LoginResponseEvent() {
    this.context = new LoginResponseContext();
  }

  @Override
  public com.google.gwt.event.shared.GwtEvent.Type<LoginResponseHandler> getAssociatedType() {
    return TYPE;
  }

  public LoginResponseContext getContext() {
    return this.context;
  };

  protected void dispatch(final LoginResponseHandler handler) {
    handler.onLoginResponse(this);
  }
}